package com.coocaa.ops.admin.v1.policygroup.handler;

import com.coocaa.ops.admin.v1.policygroup.model.HomeMatchQueryModel;
import com.coocaa.ops.common.tool.base.InstanceUtil;
import com.coocaa.ops.common.tool.string.StringUtil;
import lombok.experimental.UtilityClass;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

/**
 * @author bijiahao
 * @description
 * @date 2020/3/17 15:00
 */
@UtilityClass
public class MatchHomeHandler {

    public static Map<String, String>  getHeadMap(HomeMatchQueryModel model){
        Map<String, String> headerMap = InstanceUtil.newHashMap(6);
        headerMap.put("cChip", StringUtil.trim(model.getChip()));
        headerMap.put("cModel", StringUtil.trim(model.getModel()));
        headerMap.put("cSize", StringUtil.trim(model.getScreenSize()));
        headerMap.put("cPattern", StringUtil.trim(model.getPattern()));
        headerMap.put("cFMode", StringUtil.trim(model.getFMode()));
        if (StringUtils.isNotBlank(model.getDevId())){
            headerMap.put("cUDID", StringUtil.trim(model.getDevId()));
        }
        if (StringUtils.isNotBlank(model.getMac())){
            headerMap.put("MAC", StringUtil.trim(model.getMac()));
        }
        if (StringUtils.isNotBlank(model.getHomepageVersion())) {
            headerMap.put("vAppVersion", StringUtil.trim(model.getHomepageVersion()));
        }
        if (StringUtils.isNotBlank(model.getTcVersion())) {
            headerMap.put("cTcVersion", StringUtil.trim(model.getTcVersion()));
        }
        return headerMap;
    }
}
